package com.hznc.wcs.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description :
 * @Date : 2024/7/16
 * @Author : ChenJin
 * @Version : v1.0.0
 **/
@Getter
@AllArgsConstructor
public enum ContractAuditStatusEnum {
    
    NO_SUBMIT("0","未提交"),
    
    PROCESSING("1","已提交"),
    
    OA_PROCESSING("2","OA审批中"),
    
    OA_SUCCESS("3","OA审批通过"),

    OA_FAIL("4","OA审批不通过"),
    
    OA_REJECT("5","OA审批驳回"),

    SUPPLY("6","补充物料编码"),
    
    SAP_PROCESSING("7","SAP推送中"),
    
    SAP_PART_FINISHED("8","SAP部分推送"),
    
    SAP_ALL_FINISHED("9","SAP全部推送完成"),
    
    CANCEL("10","已取消"),
    
    DONE("11","已完成"),

    ARCHIVED("12","已归档"),
    
    HISTORY("13","历史版本");
    
    private final String code;
    
    private final String name;
    
    public static boolean canUpdate(String code){
        return !NO_SUBMIT.code.equals(code) && 
                !PROCESSING.code.equals(code) && 
                !OA_PROCESSING.code.equals(code);
    }
    
    public static boolean canDelete(String code){
        return NO_SUBMIT.code.equals(code);
    }
    
    public static boolean canCancel(String code){
        return !OA_PROCESSING.code.equals(code);
    }
    
    public static boolean canArchive(String code){
        return DONE.code.equals(code) || OA_SUCCESS.code.equals(code);
    }
}
